/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bionic.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Artem
 */
@Entity
@Table(name = "document")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Document.findAll", query = "SELECT d FROM Document d"),
    @NamedQuery(name = "Document.findById", query = "SELECT d FROM Document d WHERE d.id = :id"),
    @NamedQuery(name = "Document.findByDate", query = "SELECT d FROM Document d WHERE d.date = :date"),
    @NamedQuery(name = "Document.findByAmount", query = "SELECT d FROM Document d WHERE d.amount = :amount")})
public class Document implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date date;
    @Column(name = "amount")
    private BigDecimal amount;
    @JoinColumn(name = "account_ct", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Account accountCt;
    @JoinColumn(name = "account_dt", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Account accountDt;
    @JoinColumn(name = "currency_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Currency currencyId;
    @JoinColumn(name = "reqest_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Reqest reqestId;

    public Document() {
    }

    public Document(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public Account getAccountCt() {
        return accountCt;
    }

    public void setAccountCt(Account accountCt) {
        this.accountCt = accountCt;
    }

    public Account getAccountDt() {
        return accountDt;
    }

    public void setAccountDt(Account accountDt) {
        this.accountDt = accountDt;
    }

    public Currency getCurrencyId() {
        return currencyId;
    }

    public void setCurrencyId(Currency currencyId) {
        this.currencyId = currencyId;
    }

    public Reqest getReqestId() {
        return reqestId;
    }

    public void setReqestId(Reqest reqestId) {
        this.reqestId = reqestId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Document)) {
            return false;
        }
        Document other = (Document) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Document[ id=" + id + " ]";
    }
    
}
